package com.itheima.job6;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class DivideFile {
    public static void main(String[] args) {
        try {
            int num = 0;
            File file = new File("E:/test/part");
            FileInputStream fis = new FileInputStream("E:\\test\\123.mp4");
            byte[] buffer = new byte[1024*1024*2];
            int read;
            while ((read = fis.read(buffer)) != -1) {
                FileOutputStream fos = new FileOutputStream(file.getAbsolutePath().replaceAll("\\\\", "/") + "/" + (num++) + ".mp4");
                fos.write(buffer, 0, read);
                fos.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

